UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5wziX8v3SV98koTgjQVMo0BDh/vO3DrVWtuN+37oLTY=' 
WHERE 
  key_id = '579376391070c2a1146b3c30347dedde84687a54ed08caa447808977346841f0' 
  AND (
    token = '5wziX8v3SV98koTgjQVMo0BDh/vO3DrVWtuN+37oLTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039