UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rr+2COqYEhx+/T2tKtTbUDK5Eje5NB9UUKyinHG8dXA=' 
WHERE 
  key_id = 'c2e4cd5d51fd2fc8cf804dde842a6663754667e3813856219cfeba627628d1c6' 
  AND (
    token = 'Rr+2COqYEhx+/T2tKtTbUDK5Eje5NB9UUKyinHG8dXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046