UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PxMXcVGUjR73IV/D0zxHei23EtRxfZrwReAAU0HJlDc=' 
WHERE 
  key_id = '4476f2f37669167886b91c4c4f3f9f599b86969c1e1f0e9bdb50718b32862b06' 
  AND (
    token = 'PxMXcVGUjR73IV/D0zxHei23EtRxfZrwReAAU0HJlDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029