UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'loN1FSa5fqBNXdSQweath5ZOWDlKAK09Pbip0ErIOF8='
WHERE
key_id = '3a2d75fe0f75da3654249851e2dbf6363732acbe4e1a2a411b4cf195162c2d62'
AND (
token = 'loN1FSa5fqBNXdSQweath5ZOWDlKAK09Pbip0ErIOF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)