UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L4fPm1Ja2jxgdPjeXA7BLBME88Kzhu1sGKT/h8v1aZE=' 
WHERE 
  key_id = 'a34ff4e3deca039a6ed48670aaa5a4bc76949d219b5fe137124e4ba566b87435' 
  AND (
    token = 'L4fPm1Ja2jxgdPjeXA7BLBME88Kzhu1sGKT/h8v1aZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037