UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GYghrkwnCLtw5UK2mOhXk75O94rQGU2kSovo1UbYggk=' 
WHERE 
  key_id = '8516c72557d02df0a58a428de18faea35103ec5ca4dee332a6db25e2c10d93f8' 
  AND (
    token = 'GYghrkwnCLtw5UK2mOhXk75O94rQGU2kSovo1UbYggk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038