UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm17JTYjRxK2y8ZMh6PT011fo7wvm7zfoBFZ3zs8Nz+A=' 
WHERE 
  key_id = 'ec0f46d0c6f988da97f72d1e227f3a0d503fd4ef057dc62a5204c70480b0c407' 
  AND (
    token = 'm17JTYjRxK2y8ZMh6PT011fo7wvm7zfoBFZ3zs8Nz+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027