UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nvhFV8TCJxBTkmAB0f1adDJnWKlcas4Bj3ZsiOtXOKU=' 
WHERE 
  key_id = '93fb3e66d311393d742dc06bd58165540a617fb8e5e0afd15db521059b6f52eb' 
  AND (
    token = 'nvhFV8TCJxBTkmAB0f1adDJnWKlcas4Bj3ZsiOtXOKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041