UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P5WzKKF/yyFzvOFUX23UlDjNvD3iewM4Xy8Mv6cPo/E=' 
WHERE 
  key_id = 'a86f7a139866e49008482956ea8f687a1d31b2e57056450f1cfec33824913975' 
  AND (
    token = 'P5WzKKF/yyFzvOFUX23UlDjNvD3iewM4Xy8Mv6cPo/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041