UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JBEFFyvg6f+Hwt4d4uea8fokAbvIUTkIMhaP+4Cz7z8=' 
WHERE 
  key_id = '2a457d058bd4cb3eef21839d5a70e5fffc920cbb8ca1d5acf7b4325f1c0bf260' 
  AND (
    token = 'JBEFFyvg6f+Hwt4d4uea8fokAbvIUTkIMhaP+4Cz7z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036