UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g128A9+qi0v6fBZEhy/XPUsH+xpTa0RRQxdWUkPP0K4=' 
WHERE 
  key_id = '7f9081dee908034e2d276cab7bc8f046b8ccb954b504f033b183454d678c447c' 
  AND (
    token = 'g128A9+qi0v6fBZEhy/XPUsH+xpTa0RRQxdWUkPP0K4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023