UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rPy9WXa4KE2CPIZ4xb+IvMi6rKkQvEh7nmnHPMHh5Ig='
WHERE
key_id = 'abbea514aa107eb477522f90a9d3405c51a4f1c162f415153b8f5a564cfc2ee9'
AND (
token = 'rPy9WXa4KE2CPIZ4xb+IvMi6rKkQvEh7nmnHPMHh5Ig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)