UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'awP3T33lBtQjtstV2sjYynH7nmTeh2oMVKYQR9SxKeo=' 
WHERE 
  key_id = 'cf153864a6922a75802a657402a1d350c4190e31771f5faac764060886e6574c' 
  AND (
    token = 'awP3T33lBtQjtstV2sjYynH7nmTeh2oMVKYQR9SxKeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038