UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1EkTRaSBN3IbvK5ojnz/xzMTj4IvUl2y4OJ1vPqwQE=' 
WHERE 
  key_id = '8ef48160d24d042fc549a33a76ef2a9f3c5d2ad81d3f6e72681783b7df6547b6' 
  AND (
    token = 'y1EkTRaSBN3IbvK5ojnz/xzMTj4IvUl2y4OJ1vPqwQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040