UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xkseXY15DdLFy2q06GaJvwebKeOLmX7icyhC+GlJOQY=' 
WHERE 
  key_id = 'afbea2c9bc691f08a5a2b9f3f07b1e6f61438153d041234314bc4baa884975e2' 
  AND (
    token = 'xkseXY15DdLFy2q06GaJvwebKeOLmX7icyhC+GlJOQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017