UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+j4BboYrDjp02pS4n8RcsCGObH/artX++PMNVsI/W8E=' 
WHERE 
  key_id = '427a8e883faaee66654da65598095b9e33237a624d751e37249b4f07c52ffdb1' 
  AND (
    token = '+j4BboYrDjp02pS4n8RcsCGObH/artX++PMNVsI/W8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026