UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'psGl54npbyz6sEnAAHilTVBcbF4ZZeROfLRDSq+iXSA=' 
WHERE 
  key_id = '9de08a3438b9256cd48bddf8bdf4b0e0f134f0e8fb9841e818ebe08c4888a094' 
  AND (
    token = 'psGl54npbyz6sEnAAHilTVBcbF4ZZeROfLRDSq+iXSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037