UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Btf8VWBWv/lXUMrbszRHiPEsCt29Ztm1kVpJGaJfWIM=' 
WHERE 
  key_id = '9bb3aea72f5c59d1c55fe68bbc7328a29b68c2dd20abbc63930ee47a0dc8008f' 
  AND (
    token = 'Btf8VWBWv/lXUMrbszRHiPEsCt29Ztm1kVpJGaJfWIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031