UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kpLB8MX2dTdr+ysVi0R51bTRL4152cRukPcuwKQPsNI=' 
WHERE 
  key_id = '0bba344ac31f7395f9344cf4eff3a51d7d8c02063a31478d1c7582b615b2f7c6' 
  AND (
    token = 'kpLB8MX2dTdr+ysVi0R51bTRL4152cRukPcuwKQPsNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062