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