UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbdDAjyVFo6PbEb/9aFv2XPjpwehHt4C37UjY8d0sY8=' 
WHERE 
  key_id = '2facf59154f1ea95e07a556c2253fc30d114890dace8a1259afc4995d378a718' 
  AND (
    token = 'dbdDAjyVFo6PbEb/9aFv2XPjpwehHt4C37UjY8d0sY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026