UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PjidaNz/8kfc9VrGLA+qKByjORbmIhO97A9zE8nSzwk=' 
WHERE 
  key_id = 'c6427bc1f77edee9febb88134b30ebe5440e3bed3249537c7e2885bad1ad7e64' 
  AND (
    token = 'PjidaNz/8kfc9VrGLA+qKByjORbmIhO97A9zE8nSzwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082