UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xmFVyHAtIolO7B+T6EizmMvxrLVifSKcB+YscFZQG+I=' 
WHERE 
  key_id = '6ad27354f95c72cefac0185e5c72e6d3f1c8bac030e4516b9a0f58b550318c64' 
  AND (
    token = 'xmFVyHAtIolO7B+T6EizmMvxrLVifSKcB+YscFZQG+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042