UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm3EQGq4CFbyG02IQQEHxoDSETyRloxPLh2OOsfAA5ZM=' 
WHERE 
  key_id = '8fc32d1ed09eb26029e7cd20f74af7bb0605187854df39760857d828afaf1298' 
  AND (
    token = 'm3EQGq4CFbyG02IQQEHxoDSETyRloxPLh2OOsfAA5ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043