UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0dK0XOYUvh9N8QtIIProk84fmvUpxmfI/RfB4hjnWo=' 
WHERE 
  key_id = 'bbe3a22033563ca173ec77970f7d38dc9864fdd6e4da0bc32095932e4ce5985e' 
  AND (
    token = 'l0dK0XOYUvh9N8QtIIProk84fmvUpxmfI/RfB4hjnWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041