UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd8Vqqj//qL/xdWcfxpio3lNxk4lnF9X3DBueSSWLphs='
WHERE
key_id = '74f0f2455d558df2cf7897debd63001dd8fcfdea042167061b6495682f54781d'
AND (
token = 'd8Vqqj//qL/xdWcfxpio3lNxk4lnF9X3DBueSSWLphs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)