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