UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zpNcF4ZzZpeIqCdeXzATbftHn/GXQmJw3ajVzdIS1Xk='
WHERE
key_id = '9bd7f2a0f0592bee5d44dd239c56472a9df3b1f32a48a32759d02c432f6964cc'
AND (
token = 'zpNcF4ZzZpeIqCdeXzATbftHn/GXQmJw3ajVzdIS1Xk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)