UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XqDpCuUPWb7oCakM43bcRD8+yy8iUVylDpx3w8jj4T0='
WHERE
key_id = 'fce505d771b01a2dbbc8f479589d07893d8ea642fcfe658ab1dcda836b9145a0'
AND (
token = 'XqDpCuUPWb7oCakM43bcRD8+yy8iUVylDpx3w8jj4T0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)