UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '777YJtPaWT/ffYnK+O3w767R9JV9rUqvA5iilEuVMdw=' 
WHERE 
  key_id = 'c4de225aafc0ba6fcd039b339d5b0f98c4a73283e7818b0e1e3f890448138c3f' 
  AND (
    token = '777YJtPaWT/ffYnK+O3w767R9JV9rUqvA5iilEuVMdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037