UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EpkIDRgWx048DWI+wwSELznygB7mTDe03p1Lb9+SwZI=' 
WHERE 
  key_id = 'e411ee12198fdce0d7062108c498132882f11b830428344bf62e3bef88d14fb3' 
  AND (
    token = 'EpkIDRgWx048DWI+wwSELznygB7mTDe03p1Lb9+SwZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054