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