UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnyMMW2XaIFB3x1i4xfDWDnEKHy9UGMeTwsPQzqNYXs=' 
WHERE 
  key_id = '68d43b62585aba54af9f2c1877d0cfea812609e29b485f4bdd303b35c09f4fc1' 
  AND (
    token = 'dnyMMW2XaIFB3x1i4xfDWDnEKHy9UGMeTwsPQzqNYXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026