UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TMa3XWe83gam4RCxSm6N6abFswTW0OlkhbiWxVPnlkU=' 
WHERE 
  key_id = '5a969f641d2999919b266d0e44a6a83433b12ed04892512a74f1c9a961170855' 
  AND (
    token = 'TMa3XWe83gam4RCxSm6N6abFswTW0OlkhbiWxVPnlkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019