UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mWxvkHcbzg6dT16dxxajcDS/itbvVKeMPLaeZtc+crk=' 
WHERE 
  key_id = '3c49d19547ce585de29c18b9a22bd57e8940284114eb140f0755ea07670a382a' 
  AND (
    token = 'mWxvkHcbzg6dT16dxxajcDS/itbvVKeMPLaeZtc+crk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038