UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hqzWs8dVgA/UICOaue0atv2uUJaNddZvcOmzVhuAVHg='
WHERE
key_id = '6591e4e633274f53e76a862b00b450088629564bfb0a6e3a8a4a35919aebb9c9'
AND (
token = 'hqzWs8dVgA/UICOaue0atv2uUJaNddZvcOmzVhuAVHg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)