UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'abdK3Mnj28uj5gHHf/8//sdLkiqTluCa+qW0JNG6pn8='
WHERE
key_id = '432b2c1cfa4c73078d253c6353cf98f86b494459266eae8c11b218e2d7d722c5'
AND (
token = 'abdK3Mnj28uj5gHHf/8//sdLkiqTluCa+qW0JNG6pn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)