UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EOyVs1esa8YCvWUeW9yb93iDBT+viOviba2lop2ltqA=' 
WHERE 
  key_id = 'e05e01524e8bdedf97874d383a9c3f6c41a9374e58c86de9c90e893809e73fa6' 
  AND (
    token = 'EOyVs1esa8YCvWUeW9yb93iDBT+viOviba2lop2ltqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047