UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qwMAycwhmLNY8VmIfceEaWXzevOyxh4Ljleuw+NR06o=' 
WHERE 
  key_id = '0d3c6c5ca5193d06444f1dde46e030964d63b21cb885abc6163e58131f8afd84' 
  AND (
    token = 'qwMAycwhmLNY8VmIfceEaWXzevOyxh4Ljleuw+NR06o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028