UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eBMLMP0QJhZX2KlOVZY1IvA2biHIE5Vpi0FyB0yuzrc=' 
WHERE 
  key_id = '9e2d76ef2366e1b352a8d5afd831f436932060e5746374f96922f17419ccd7ff' 
  AND (
    token = 'eBMLMP0QJhZX2KlOVZY1IvA2biHIE5Vpi0FyB0yuzrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042