UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DtDeHlE4BMwKpe7Xx5sTm8MtuI51avK2ExY6/HOfZRY=' 
WHERE 
  key_id = 'd51935b98af60f6b997b015399cd18d2330e67716f6596d66e9dbcf2bcb7078f' 
  AND (
    token = 'DtDeHlE4BMwKpe7Xx5sTm8MtuI51avK2ExY6/HOfZRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036