UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VlUiBiM19sjEAeh9cazP16hsn2Uj3mMBpVlXNYucoOI=' 
WHERE 
  key_id = '7b96a01f0e372857715999964072824c55dc9cfd1c1185cb26a2be10971af7e4' 
  AND (
    token = 'VlUiBiM19sjEAeh9cazP16hsn2Uj3mMBpVlXNYucoOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045