UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XmEsLvy08mqMhX4Ab8zxJ+bKNtcr5BjxV9LVKq0qiwM=' 
WHERE 
  key_id = '39ebac44cb7ae53a81f6043c00592cf80e27a4bfda484722eb0398bd9a3f9be5' 
  AND (
    token = 'XmEsLvy08mqMhX4Ab8zxJ+bKNtcr5BjxV9LVKq0qiwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045