UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TkvQcO5kmUJJVpRm9ZBtAa0FT8kpmiRM+4y3jnKx1E8=' 
WHERE 
  key_id = '8d391015bcf936526c3779b82df058f1a351f3cf71d2213803a84476adf90d27' 
  AND (
    token = 'TkvQcO5kmUJJVpRm9ZBtAa0FT8kpmiRM+4y3jnKx1E8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033