UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's2jWIjsrfnn+rZagC5+tA8gIMX1Yy7k8ZOdG7ZrTXQ8='
WHERE
key_id = '1936a6b32dff2d5a4035d493612db3bb761e29399e6e57adea8914a4381a2bee'
AND (
token = 's2jWIjsrfnn+rZagC5+tA8gIMX1Yy7k8ZOdG7ZrTXQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)