UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmpWPsqBZFy6PE4gEWqaHI7ZlZB1OY990vw6fbgD5Vo=' 
WHERE 
  key_id = 'f74cf857c2860c5865216b1587789360a02afe531b7169b85c2fdb454301061a' 
  AND (
    token = 'jmpWPsqBZFy6PE4gEWqaHI7ZlZB1OY990vw6fbgD5Vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031