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