UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPNMbvbWdy7O1XUZ20fPnRW474DqSSFALXVpU3RTQgo='
WHERE
key_id = 'f2fb8d1ea533747c8c2e61110a2194c7381c565a2a1bbfefbfb412e5db4dcda5'
AND (
token = 'NPNMbvbWdy7O1XUZ20fPnRW474DqSSFALXVpU3RTQgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)