UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vqmDsBBP9oR9EvKuwLdRM6/CaTtgMmA6bhfQ0OH1RVA=' 
WHERE 
  key_id = 'e9ea12e250c8587709b1a0bf43610c4395ab294027cd8bf7a6a9255f8d2a3369' 
  AND (
    token = 'vqmDsBBP9oR9EvKuwLdRM6/CaTtgMmA6bhfQ0OH1RVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032