UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uW7YU868RaEDvCXg1AnaMt9gXdtNV1ja9dhifNp91WY=' 
WHERE 
  key_id = 'f72823764bbcc5931cd4417d49b16fe5a34ce36b549b4fbbd80f65645031b014' 
  AND (
    token = 'uW7YU868RaEDvCXg1AnaMt9gXdtNV1ja9dhifNp91WY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021