UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3imeTwlgwcP1aZ8WFRFd1W9h+Kk16pdj6wmSYpXg+Qo=' 
WHERE 
  key_id = '0f0ec3157593e48bbd706554afd1cfd8577228b67ff0b7302bbd5f2b39158a59' 
  AND (
    token = '3imeTwlgwcP1aZ8WFRFd1W9h+Kk16pdj6wmSYpXg+Qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057