UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tmAC6/5Jm2uClsHRKExzmNIgfAjopFajuzOEW2mTFuM=' 
WHERE 
  key_id = '78180c565c6bb7debf7a379de713acea77bff244dabfed53291551f2bad22de3' 
  AND (
    token = 'tmAC6/5Jm2uClsHRKExzmNIgfAjopFajuzOEW2mTFuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027