UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QN9RR7eE6nr3rgIEfIkZV/eqGjWUS9paSqtJrzNAyrk='
WHERE
key_id = 'aa27fd541cc8eac9a29c1f2d1c9ffeeba5b3337f27f2374e4fd5670258556ffa'
AND (
token = 'QN9RR7eE6nr3rgIEfIkZV/eqGjWUS9paSqtJrzNAyrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)