UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gtYl9fNi1AgZxMfEtN+zTks1toDIq5P8ReQ1NuSYJq8=' 
WHERE 
  key_id = '1f377dcb2ee0602da11a43ae77d0f36ba55b031b3c9ace9c33ef0e81d73c1971' 
  AND (
    token = 'gtYl9fNi1AgZxMfEtN+zTks1toDIq5P8ReQ1NuSYJq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027