UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UMpEZ9m+uSgL8OGjx/ursnx5/xnovcYNNYzCk0Mectc=' 
WHERE 
  key_id = '851194501530932bed6b1996012e339b61cd7f4f161ff42e8bf9f57a0dd208d3' 
  AND (
    token = 'UMpEZ9m+uSgL8OGjx/ursnx5/xnovcYNNYzCk0Mectc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032