UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DmR3YeApD82cHEOt6VxJf/I8Vt+8LLYVA0YRtXV0u8k='
WHERE
key_id = 'b81a318b9e0135eb27b82e94c17ebcf6e3cca7e9b1a1f47496884d1eb5836137'
AND (
token = 'DmR3YeApD82cHEOt6VxJf/I8Vt+8LLYVA0YRtXV0u8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)