UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1ISYO/9kgU4BZb0EirgXVOJL8m0VMy2sURY5tnkk/uo=' 
WHERE 
  key_id = '7b562ad6b5af5285e3168926edee4856c8e187147fe6451e236ed94fb49640d9' 
  AND (
    token = '1ISYO/9kgU4BZb0EirgXVOJL8m0VMy2sURY5tnkk/uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032