UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rReItMc2yqTnwFcojus5s/Efxj/gQbKN4R6OVtbFk4k=' 
WHERE 
  key_id = '0822d2539b06416e0652c410073e9738222b1a7c272a2675be822438e8aec715' 
  AND (
    token = 'rReItMc2yqTnwFcojus5s/Efxj/gQbKN4R6OVtbFk4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032