UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '02wN5cmgRw5q6VXuUyI9IiDUKJP+eavK1i6Mskzg7oc='
WHERE
key_id = 'fd5e9c63dbec81f8c6639eef2c6f52df8b40de0dcae59c448a451b6590d30bb9'
AND (
token = '02wN5cmgRw5q6VXuUyI9IiDUKJP+eavK1i6Mskzg7oc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)